<template>
	<view class="content">
		<view class="navBox">
			<view class="navItem" @click="current=0">
				<image :src="current==0?'../../static/image/xttzs.png':'../../static/image/xttz.png'" class="icon" mode=""></image>
				<view class="text" :style="current==0?'color:#1AA261;':''">系统通知</view>
			</view>
			<view class="navItem" @click="current=1">
				<image :src="current==1?'../../static/image/ddtzs.png':'../../static/image/ddtz.png'" class="icon" mode=""></image>
				<view class="text" :style="current==1?'color:#1AA261;':''">订单通知</view>
			</view>
			<view class="navItem" @click="current=2">
				<image :src="current==2?'../../static/image/hdtzs.png':'../../static/image/hdtz.png'" class="icon" mode=""></image>
				<view class="text" :style="current==2?'color:#1AA261;':''">活动通知</view>
			</view>
			<view class="navItem" @click="current=3">
				<image :src="current==3?'../../static/image/wltzs.png':'../../static/image/wltz.png'" class="icon" mode=""></image>
				<view class="text" :style="current==3?'color:#1AA261;':''">物流通知</view>
			</view>
		</view>
		
		<view class="contexts">
			<view style="height: 600rpx;" v-if="list.length==0">
				<u-empty text="暂无消息" mode="message"></u-empty>
			</view>
			<view class="item" v-for="(item,index) in list" v-else>
				<view class="time">{{item.created_at||'...'}}</view>
				<view class="context">{{item.content||'...'}}</view>
			</view>
		</view>
		<!-- 导航栏 -->
		<tabbar link="/pages/notice/notice"></tabbar>
	</view>
</template>

<script>
	import tabbar from '../../components/tabbar/tabbar.vue'
	import {noticeList} from '../../common/api.js'
	export default {
		components:{tabbar},
		data() {
			return {
				current:0,
				list:[],
			}
		},
		onLoad(e) {
			this.getList()
		},
		methods: {
			getList(){
				noticeList({
					type:''
				}).then(res=>{
					if(res.code==10000){
						this.list = res.data.list
					}
				})
			},
			goInfo(url){
				uni.navigateTo({
					url:url
				})
			},
		}
	}
</script>
<style>
page{
	background: #EDEFF2;
}
</style>
<style lang="scss" scoped>
.content{
	width: 750rpx;
	padding: 32rpx;
	box-sizing: border-box;
	.navBox{
		display: flex;
		justify-content: space-around;
		align-items: center;
		.navItem{
			width: 25%;
			.icon{
				width: 80rpx;
				height: 80rpx;
				margin-left: 50%;
				transform: translateX(-50%);
			}
			.text{
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 24rpx;
				color: #333333;
				line-height: 24rpx;
				text-align: center;
				font-style: normal;
				margin-top: 16rpx;
			}
		}
	}
	.contexts{
		margin-top: 48rpx;
	}
	.item{
		margin-bottom: 32rpx;
		.time{
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			font-size: 24rpx;
			color: #999999;
			line-height: 24rpx;
			text-align: center;
			font-style: normal;
		}
		.context{
			background: #FFFFFF;
			border-radius: 20rpx;
			padding: 30rpx 32rpx;
			box-sizing: border-box;
			margin-top: 32rpx;
		}
	}
}
</style>
